/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.myapp.DAO;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apt.Bean.GroupPaymentEntities;
import org.apt.connectDB.MyConnect;

/**
 *
 * @author Administrator
 */
public class GroupPaymentDao {

    public static List<GroupPaymentEntities> getAllCroupPayment() {
        Connection connection = null;
        Statement statement = null;
        ResultSet resultSet = null;
        List<GroupPaymentEntities> listGoupPayment = new ArrayList<GroupPaymentEntities>();
        String sql = "select * from GroupPayment ";

        try {
            connection = MyConnect.getConnection();
            statement = connection.createStatement();
            resultSet = statement.executeQuery(sql);
            while (resultSet.next()) {
                GroupPaymentEntities goupPayment = new GroupPaymentEntities();
                goupPayment.setID(resultSet.getInt("ID"));
                goupPayment.setStyle(resultSet.getString("Style"));
                listGoupPayment.add(goupPayment);
            }
        } catch (SQLException ex) {
            Logger.getLogger(MyConnect.class.getName()).log(Level.SEVERE, null, ex);
        } finally {
            MyConnect.closeConntion(connection, statement, resultSet);
        }
        return listGoupPayment;
    }
}
